package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Application;
import com.briup.recognition.bean.ApplicationExample;
import com.briup.recognition.dao.ApplicationMapper;
import com.briup.recognition.service.IApplicationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: ldd
 * @Date: 2021/03/28/21:33
 * @Description:
 */

@Service
public class ApplicationServiceImpl implements IApplicationService{

    @Resource
    private ApplicationMapper applicationMapper;

    @Override
    public List<Application> query(){
        ApplicationExample example = new ApplicationExample();

        return applicationMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Application application){
        if (application.getId()!=null){
            applicationMapper.updateByPrimaryKey(application);
        }else {
            applicationMapper.insert(application);
        }
    }
    @Override
    public void deleteById(long id){
        applicationMapper.deleteByPrimaryKey(id);
    }
}
